<template>
  <div class="mui-numbox"
       data-numbox-min='1'>
    <button class="mui-btn mui-btn-numbox-minus"
            type="button"
            style="
    width: 0.6rem;
">-</button>
    <input id="test"
           class="mui-input-numbox"
           type="number"
           :value="initCount"
           @change="countChange"
           ref="numbox"
           readonly />
    <button class="mui-btn mui-btn-numbox-plus"
            type="button"
            style="
    width: 0.6rem;
">+</button>
  </div>
</template>
<script>
import mui from '../../mui/js/mui.min.js'

export default {
  methods: {
    countChange () {
      this.$store.commit('updataCarCount', { id: this.goodsid, count: this.$refs.numbox.value })
    }
  },
  mounted () {
    mui('.mui-numbox').numbox() // 初始化数字选择框
    // mui('.mui-numbox').numbox().setOption('step', 1)
  },
  props: ['initCount', 'goodsid']
}
</script>
<style lang="less" scoped>
</style>
